{% extends 'base.html' %}

{% block title %}修改密码 - 花店订单系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h3 class="text-center">修改密码</h3>
            </div>
            <div class="card-body">
                {% if form.non_field_errors %}
                    <div class="alert alert-danger">
                        {% for error in form.non_field_errors %}
                            {{ error }}
                        {% endfor %}
                    </div>
                {% endif %}

                <form method="post">
                    {% csrf_token %}
                    {% for field in form %}
                        <div class="mb-3">
                            <label for="{{ field.id_for_label }}" class="form-label">{{ field.label }}</label>
                            {{ field }}
                            {% if field.errors %}
                                <div class="alert alert-danger mt-1">
                                    {% for error in field.errors %}
                                        <small>{{ error }}</small><br>
                                    {% endfor %}
                                </div>
                            {% endif %}
                            {% if field.help_text %}
                                <div class="form-text">
                                    <small class="text-muted">{{ field.help_text }}</small>
                                </div>
                            {% endif %}
                        </div>
                    {% endfor %}
                    <div class="d-grid gap-2">
                        <button type="submit" class="btn btn-primary">修改密码</button>
                        <a href="{% url 'home' %}" class="btn btn-secondary">返回首页</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<style>
    /* 美化表单字段样式 */
    .form-control {
        border-radius: 0.25rem;
        border: 1px solid #ced4da;
        padding: 0.375rem 0.75rem;
        width: 100%;
    }
    
    /* 密码强度提示样式 */
    .text-muted {
        font-size: 0.875rem;
    }
    
    /* 错误信息样式 */
    .alert-danger {
        font-size: 0.875rem;
        padding: 0.5rem;
        margin-top: 0.25rem;
    }
    
    /* 表单字段样式 */
    input[type="password"] {
        width: 100%;
        margin-bottom: 0.5rem;
    }
</style>
{% endblock %} 